<!--$embed{"header.htm"}-->

<!--$if{ op == 'edit'}-->

<div id="${pid}" <!--$if{ !_SGLOBAL['inajax']}-->class="c_form"<!--$else-->class="inajax"<!--$end-->>
<!--$if{ _SGLOBAL['inajax']}-->
<h1>编辑</h1>
<a href="javascript:hideMenu();" class="float_del" title="关闭">关闭</a>
<div class="popupmenu_inner">
<!--$end-->
	<form id="editpostform_${pid}" name="editpostform_${pid}" method="post" action="cp.html?ac=thread&op=edit&pid=${pid}&tagid=${tagid}">
		<table>
			<tr>
				<th style="vertical-align: top;"><label for="message">内容：</label></th>
				<td>
					<a href="###" id="face_${pid}" onclick="showFace(this.id, 'message_${pid}');"><img src="image/facelist.gif" align="absmiddle" /></a>
					<img src="image/zoomin.gif" onmouseover="this.style.cursor='pointer'" onclick="zoomTextarea('message', 1)">
					<img src="image/zoomout.gif" onmouseover="this.style.cursor='pointer'" onclick="zoomTextarea('message', 0)"><br/>
					<textarea id="message_${pid}" name="message"  style="width:98%;" onkeydown="ctrlEnter(event, 'posteditsubmit_btn');" <!--$if{ post['isthread']}-->rows="18"<!--$else-->rows="8"<!--$end-->>${post['message']}</textarea>
				</td>
			</tr>
			<tbody id="editwebimg">
				<tr>
					<th>图片：</th>
					<td>
						<input class="t_input" type="text" onfocus="if(this.value == 'http://')this.value='';" onblur="if(this.value=='')this.value='http://'" name="pics[]" value="http://" size="40" />&nbsp;
						<a href="javascript:;" onclick="insertWebImg(this.previousSibling.previousSibling)">插入</a> &nbsp;
						<a href="javascript:;" onclick="delRow(this, 'editwebimg')">删除</a>
					</td>
				</tr>
			</tbody>
			<tr>
				<th>&nbsp;</th>
				<td>
					<a href="javascript:;" onclick="copyRow('editwebimg')">+增加图片</a> <span class="gray">只支持 .jpg、.gif、.png为结尾的URL地址</span>
				</td>
			</tr>
			<tr>
				<th>&nbsp;</th>
				<td>
				<input type="hidden" name="pid" value="${pid}">
				<input type="hidden" name="refer" value="${_SGLOBAL['refer']}" />
				<input type="hidden" name="posteditsubmit" value="true" />
				<!--$if{ _SGLOBAL['inajax']}-->
				<input type="button" name="posteditsubmit_btn" id="posteditsubmit_btn" value="提交" class="submit" onclick="ajaxpost('editpostform_${pid}', '${pid}', 'post_edit')" />&nbsp;
				<!--$else-->
				<input type="submit" name="posteditsubmit_btn" id="posteditsubmit_btn" value="提交" class="submit" />&nbsp;
				<!--$end-->
				</td>
			</tr>
		</table>
	<input type="hidden" name="formhash" value="<!--${&com.heaven.web.utils.Common.formhash()}-->" />
	</form>
<!--$if{ _SGLOBAL['inajax']}--></div><!--$end-->
</div>

<!--$elseif{ op == 'delete'}-->

<div id="${pid}" <!--$if{ !_SGLOBAL['inajax']}-->class="inpage"<!--$end-->>
<form id="delete_postform_${pid}" name="delete_postform_${pid}" method="post" action="cp.html?ac=thread&op=delete&pid=${pid}&tagid=${tagid}">
	<h1>确定删除指定的帖子吗？</h1>
	<p class="btn_line">
		<input type="hidden" name="refer" value="${_SGLOBAL['refer']}" />
		<!--$if{ _SGLOBAL['inajax']}-->
		<input type="hidden" name="postdeletesubmit" value="true" />
		<input type="button" name="postdeletesubmit_btn" value="提交" class="submit" onclick="ajaxpost('delete_postform_${pid}', '${pid}', 'post_delete')" />&nbsp;
		<button name="btncancel" type="button" class="button" onclick="hideMenu()">取消</button>
		<!--$else-->
		<input type="submit" name="postdeletesubmit" value="提交" class="submit" />&nbsp;
		<!--$end-->
	</p>
<input type="hidden" name="formhash" value="<!--${&com.heaven.web.utils.Common.formhash()}-->" /></form>
</div>

<!--$elseif{ op == 'reply'}-->

<div id="${post['pid']}" <!--$if{ !_SGLOBAL['inajax']}-->class="inpage"<!--$else-->class="inajax"<!--$end-->>
<!--$if{ _SGLOBAL['inajax']}-->
	<h1>回复</h1>
	<a href="javascript:hideMenu();" class="float_del" title="关闭">关闭</a>
	<div class="popupmenu_inner">
<!--$end-->
<form id="reply_postform_${post['pid']}" name="reply_postform_${post['pid']}" method="post" action="cp.html?ac=thread">
	<table>
		<tr>
			<th><label for="message">内容：</label></th>
			<td>
				<a href="###" id="face_${post['pid']}" onclick="showFace(this.id, 'message_${post['pid']}');"><img src="image/facelist.gif" align="absmiddle" /></a>
				<img src="image/zoomin.gif" onmouseover="this.style.cursor='pointer'" onclick="zoomTextarea('message', 1)">
				<img src="image/zoomout.gif" onmouseover="this.style.cursor='pointer'" onclick="zoomTextarea('message', 0)"><br/>
				<textarea id="message_${post['pid']}" name="message" onkeydown="ctrlEnter(event, 'postsubmit');" rows="8" cols="70"></textarea>
			</td>
		</tr>
		<tbody id="replybimg">
			<tr>
				<td>图片：</td>
				<td>
					<input class="t_input" type="text" name="pics[]" onfocus="if(this.value == 'http://')this.value='';" onblur="if(this.value=='')this.value='http://'" value="http://" size="30" />&nbsp;
					<a href="javascript:;" onclick="insertWebImg(this.previousSibling.previousSibling)">插入</a> &nbsp;
					<a href="javascript:;" onclick="delRow(this, 'replybimg')">删除</a>
				</td>
			</tr>
		</tbody>
		<tr>
			<th>&nbsp;</th>
			<td>
				<a href="javascript:;" onclick="copyRow('replybimg')">+增加图片</a> <span class="gray">只支持 .jpg、.gif、.png为结尾的URL地址</span>
			</td>
		</tr>
	
		<tr>
			<td>&nbsp;</td>
			<td>
				<input type="hidden" name="refer" value="${_SGLOBAL['refer']}" />
				<input type="hidden" name="tid" value="${tid}" />
				<input type="hidden" name="pid" value="${pid}" />
				<!--$if{ _SGLOBAL['inajax']}-->
				<input type="hidden" name="postsubmit" value="true" />
				<input type="button" name="postsubmit_btn" id="postsubmit" value="回复" class="submit" onclick="ajaxpost('reply_postform_${post['pid']}', '${post['pid']}', 'post_add')" />
				<!--$else-->
				<input type="submit" name="postsubmit" id="postsubmit" value="回复" class="submit" />
				<!--$end-->
			</td>
		</tr>
	</table>
<input type="hidden" name="formhash" value="<!--${&com.heaven.web.utils.Common.formhash()}-->" />
</form>
<!--$if{ _SGLOBAL['inajax']}--></div><!--$end-->
</div>

<!--$else-->

<script language="javascript" src="image/editor/editor_function.js"></script>
<script type="text/javascript">
	function validate(obj) {
	    var subject = document.getElementById('subject');
	    document.getElementById('realmessage').value = KE.util.getData('post-message');
	    if (subject) {
	    	var slen = strlen(subject.value);
	        if (slen < 1 || slen > 80) {
	            alert("标题长度(1~80字符)不符合要求");
	            subject.focus();
	            return false;
	        }
	    }
	    if(document.getElementById('seccode')) {
			var code = document.getElementById('seccode').value;
			var x = new Ajax();
			x.get('cp.html?ac=common&op=seccode&code=' + code, function(s){
				s = trim(s);
				if(s.indexOf('succeed') == -1) {
					alert(s);
					document.getElementById('seccode').focus();
	           		return false;
				} else {
					uploadEdit(obj);
					return true;
				}
			});
	    } else {
	    	uploadEdit(obj);
	    	return true;
	    }
	}
</script>


<h2 class="title"><img src="image/app/mtag.gif" />群组</h2>
<div class="tabs_header">
	<ul class="tabs">
	<!--$if{ thread}-->
		<li class="active"><a href="cp.html?ac=thread&op=edit&pid=${post['pid']}"><span>编辑话题</span></a></li>
		<li><a href="space.html?do=mtag&tagid=${thread['tagid']}&view=list"><span>返回讨论区</span></a></li>
	<!--$else-->	
		<li class="active"><a href="cp.html?ac=thread"><span>发表新话题</span></a></li>
		<li><a href="space.html?do=thread&view=me"><span>返回我的话题</span></a></li>
	<!--$end-->
	</ul>
</div>


<style>
	.userData {behavior:url(#default#userdata);}
</style>

<div class="c_form">
	<form method="post" action="cp.html?ac=thread" enctype="multipart/form-data">
		<table cellspacing="4" cellpadding="4" width="100%" class="infotable">
		<!--$if{ !tagid}-->
			<tr>
				<td>
				<select name="tagid" id="tagid">
				<!--$for{entry:mtaglist}-->
				<!--$for{subentry:entry.value} $set{value=subentry.value}-->
					<option value="${value['tagid']}">[${_SGLOBAL['profield'][value['fieldid']]['title']}] ${value['tagname']}</option>
				<!--$end-->
				<!--$end-->
				</select>
				<a href="cp.html?ac=mtag">创建新群组</a>
				</td>
			</tr>
		<!--$else-->
			<tr>
				<td>${mtag['tagname']}<!--$if{ !thread}--> [<a href="cp.html?ac=thread">切换</a>]<!--$end-->
					<input type="hidden" name="tagid" value="${tagid}" />
				</td>
			</tr>
		<!--$end-->
			<tr>
				<td><input type="text" class="t_input" id="subject" name="subject" value="${thread['subject']}" size="60" /></td>
			</tr>
			<tr>
				<td>
				
				
				<textarea class="userData" name="message" id="realmessage" style="height:100%;width:100%;display:none;border:0px"></textarea>
			  	<textarea id="post-message" style="width:700px;height:300px;visibility:hidden;" >${post.message}</textarea>
	            <script type="text/javascript" charset="utf-8" src="common/kindeditor/kindeditor.js"></script>
	            <script type="text/javascript">
	            KE.show({
	                id : 'post-message',
	                cssPath : './index.css',
	                items : [
	                   'source','undo', 'redo', 'fontname', 'fontsize', 'textcolor', 'bgcolor', 'bold', 'italic', 'underline',
	                   'removeformat', 'image','flash','media','link','unlink']
	            });
	            </script>
				
				</td>
			</tr>
		</table>
		<!--$if{seccode}-->
		<table cellspacing="4" cellpadding="4" width="100%" class="infotable">
			<!--$if{ _SCONFIG['questionmode']}-->
			<tr>
				<td>
					<p>请回答验证问题</p>
					<p><!--${&com.heaven.web.utils.Common.question()}--></p>
					<input type="text" id="seccode" name="seccode" value="" size="15" class="t_input" />
				</td>
			</tr>
			<!--$else-->
			<tr>
				<td>
					<p>请填写验证码</p>
					<script>seccode();</script>
					<p>请输入上面的4位字母或数字，看不清可<a href="javascript:updateseccode()">更换一张</a></p>
					<input type="text" id="seccode" name="seccode" value="" size="15" class="t_input" />
				</td>
			</tr>
			<!--$end-->
		</table>
		<!--$end-->
		<input type="hidden" name="tid" value="${thread['tid']}" />
		<input type="hidden" name="threadsubmit" value="true" />
		<input type="submit" id="threadbutton" name="threadbutton" value="提交发布" onclick="validate(this);" style="display: none;" />
		<input type="hidden" name="formhash" value="<!--${&com.heaven.web.utils.Common.formhash()}-->" />
	</form>
	
	<table cellspacing="4" cellpadding="4" width="100%" class="infotable">
		<tr>
			<td><input type="button" id="issuance" onclick="document.getElementById('threadbutton').click();" value="保存发布" class="submit" /></td>
		</tr>
	</table>
</div>

<!--$end-->

<!--$embed{"footer.htm"}-->